﻿using System;

class ReplaceForbiddenWords
{
    static void Main()
    {
        //Exercise 9.
        //We are given a string containing a list of forbidden words and a text containing some of these words. 
        //Write a program that replaces the forbidden words with asterisks. Example:

        //Microsoft announced its next generation PHP compiler today. It is based on .NET Framework 4.0 and is implemented as a 
        //dynamic language in CLR.
        	
		//Words: "PHP, CLR, Microsoft"
		//The expected result:

        //********* announced its next generation *** compiler today. It is based on .NET Framework 4.0 and is implemented as 
        //a dynamic language in ***.

        string text = @"Microsoft announced its next generation PHP compiler today. It is based on .NET Framework 4.0 and is implemented as a dynamic language in CLR.";
        string forbiddenWords = "PHP, CLR, Microsoft";
        string[] forbidden = forbiddenWords.Split(',');

        for (int i = 0; i < forbidden.Length; i++)
        {
            forbidden[i] = forbidden[i].Trim();
            text = text.Replace(forbidden[i], new string('*', forbidden[i].Length));
        }
        Console.WriteLine(text);

    }
}

